#include<iostream>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;

int temp[230];

int main(){
	string s;
	cin>>s;
	int l = 0, r = 0;
	int ans = 0;
	while (r < s.length())
	{
		temp[s[r]] += 1;
		while (temp[s[r]] >= 2)
		{
			temp[s[l]] -= 1; l += 1;
		}
		ans = max(ans, r - l + 1);
		r++;
	}
	cout << ans << endl;
	return 0; 
}

